abstract class Animal {
    public String name;
    public int age;
    abstract public void eat();
}
class Dog extends Animal {
    @Override
    public void eat() {
        System.out.println("吃狗粮");
    }
}
class Cat extends Animal {
    @Override
    public void eat() {
        System.out.println("吃猫粮");
    }
}

public class Test {
    public static void test(Animal animal) {
        animal.eat();
    }
    public static void main(String[] args) {
        Animal animal = new Dog();
        Animal animal1 = new Cat();
        test(animal);
        test(animal1);
        test(new Dog());
    }



//    public static void main(String[] args) {
////        Animal animal = new Animal();
//    }
}
